package cn.newgrand.netcall.muc;
/**
 * 
 */
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.TimerTask;

import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.tree.TreePath;

import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smackx.bookmark.BookmarkManager;
import org.jivesoftware.spark.SparkManager;
import org.jivesoftware.spark.component.JiveTreeCellRenderer;
import org.jivesoftware.spark.component.JiveTreeNode;
import org.jivesoftware.spark.component.RolloverButton;
import org.jivesoftware.spark.component.Tree;
import org.jivesoftware.spark.ui.conferences.BookmarksUI;
import org.jivesoftware.spark.util.GraphicUtils;
import org.jivesoftware.spark.util.SwingTimerTask;
import org.jivesoftware.spark.util.TaskEngine;
import org.jivesoftware.spark.util.log.Log;

/**
 * 中国习惯群聊功能实现面板
 * 
 * @author sidneyren
 */
public class MUCUI extends JPanel {
	private JPanel choosePanel;
	private JButton groupButton;
	private JButton conferenceButton;
	private JPanel contentPanel;
	//中国群管理界面
	private ChinaGroupUI groupManagerUI;
	//会议书签（常用的会议）
	private BookmarksUI bookmarksUI;
	
	
	private static MUCUI instance = new MUCUI();

	private MUCUI() {
		//去掉群聊TAB页下的会议
		groupButton = new RolloverButton("群");
		conferenceButton = new RolloverButton("会议");
		choosePanel = new JPanel();
		choosePanel.setLayout(new FlowLayout(FlowLayout.LEFT,2,2));
	
		//choosePanel.add(groupButton);
		//choosePanel.add(conferenceButton);
		
		groupManagerUI = new ChinaGroupUI();
		bookmarksUI = new BookmarksUI();
		
		setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY));
		setLayout(new GridBagLayout());
		add(groupManagerUI, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
		//add(choosePanel, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0,GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL,new Insets(0, 2, 2, 2), 0, 0));
		
		groupButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				groupManagerUI.setVisible(true);
				bookmarksUI.setVisible(false);
			}
		});
		conferenceButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				add(bookmarksUI, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
				groupManagerUI.setVisible(false);
				bookmarksUI.setVisible(true);
			}
		});
	}
	
	public static MUCUI getInstance(){
		return instance;
	}
	
	public ChinaGroupUI getChinagGroupUI(){
		return groupManagerUI;
	}
}
